package com.example.blog_springboot.api;

import com.example.blog_springboot.api.config.exception.RepeatException;
import com.example.blog_springboot.model.User;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;

@RequestMapping("/user")
public interface UserRest {
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    void login(String username, String password, HttpServletRequest request) throws Exception;

    @RequestMapping(value = "/reg", method = RequestMethod.POST)
    void reg(String username, String password, HttpServletRequest request) throws Exception;

    @RequestMapping(value = "/logout", method = RequestMethod.GET)
    void logout(HttpServletRequest request) throws Exception;

    @RequestMapping(value = "/getUser", method = RequestMethod.GET)
    User getUser(@SessionAttribute("user")User user);

    @RequestMapping(value = "/getWriter", method = RequestMethod.GET)
    User getWriter(String blogId,@SessionAttribute("user")User user) throws Exception;
}